/**
 * Copyright (C) 2025 pony working team
 * SPDX-License-Identifier: MulanPSL-2.0
 */

/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __M_MEMTRY_H__
#define __M_MEMTRY_H__

/* includes (standard library, system) ---------------------------------------*/
/* includes (other library) --------------------------------------------------*/
/* includes (project) --------------------------------------------------------*/
#include <k_errno.h>
#include <x_module.h>
/* includes (local) ----------------------------------------------------------*/

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/* defines -------------------------------------------------------------------*/

#ifndef MEMTRY_MAX_ORDER
#define MEMTRY_MAX_ORDER 3
#endif

#define ERRNO_MEMTRY_ILLEGAL_ORDER ERRNO_JOIN(MID_MEMTRY, 1)
#define ERRNO_MEMTRY_NO_ACCESS     ERRNO_JOIN(MID_MEMTRY, 2)

/* typedefs ------------------------------------------------------------------*/
/* macro ---------------------------------------------------------------------*/
/* inlines -------------------------------------------------------------------*/
/* externs -------------------------------------------------------------------*/

extern int mem_try(void *dst, void *src, int order);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __M_MEMTRY_H__ */
